'use strict';
// Copyright 2014 Blueant Inc. All Rights Reserved.

/**
 * @fileoverview 生成VIP奖励
 * @author sundbcn@gmail.com (sun debing)
 */

var _ = require('lodash');
var dataApi = require('../libs/dataApi');
var genRewardService = require('./genRewardService');
var vipConf = require('../config/vipConf');

/**
 * 生成VIP奖励
 * @param  {[type]} equip_type [description]
 * @return {[type]}            [description]
 */
exports.generateVipReward = function (vip, job_type) {
    var reward = [];
    var vip_reward_key = job_type * 100 + vip;
    var reward_conf = dataApi.vip_reward.findById(vip_reward_key);
    _.each(reward_conf, function (reward_item) {
        reward.push(genRewardService.generateReward(reward_item));
    });
    return reward;
};

/**
 * 生成VIP超值礼包
 * @param  {[type]} equip_type [description]
 * @return {[type]}            [description]
 */
exports.generateVipPackage = function (vip) {
    var vip_lv_conf = vipConf.getConf(vip);
    return genRewardService.generateReward(vip_lv_conf);
};
